package com.jinzhi.jzdoor.examination.controller;

import com.jinzhi.common.annotation.Log;
import com.jinzhi.common.base.BaseController;
import com.jinzhi.common.domain.DictDO;
import com.jinzhi.common.service.DictService;
import com.jinzhi.oss.service.FileService;
import com.jinzhi.sms.support.SmsManager;
import com.jinzhi.sys.service.UserRoleService;
import com.jinzhi.sys.service.UserService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@AllArgsConstructor
@RequestMapping("/examination")
public class LoginController extends BaseController {

	@Autowired
	private FileService fileService;


	@Autowired
	private SmsManager smsService;

	@Autowired
	private UserService userService;

	@Autowired
	private UserRoleService userRoleService;

	@Autowired
	private DictService dictService;

	private static final String O_REG_SMS_PREFIX = "ORTHER_REG_";//其他端


	
	@Log("跳转登录页面")
	@GetMapping("/lx")
	String lx(Model model) {
		DictDO dic = dictService.findOneByKv("type" , "exam_num");
		DictDO dic1 = dictService.findOneByKv("type" , "send_num");

		model.addAttribute("time" , dic.getValue());
		model.addAttribute("dates" , dic1.getValue());
		return "examinationWeb/login2";
	}

	@Log("跳转登录页面")
	@GetMapping("/login")
	String login(Model model) {
		DictDO dic = dictService.findOneByKv("type" , "exam_num");
		DictDO dic1 = dictService.findOneByKv("type" , "send_num");

		model.addAttribute("time" , dic.getValue());
		model.addAttribute("dates" , dic1.getValue());
		return "examinationWeb/login";
	}

	@Log("跳转开始考试页面")
	@GetMapping("/startExam")
	String startExam(Model model) {
		return "examinationWeb/startExam";
	}

	@Log("跳转考试页面")
	@GetMapping("/exam")
	String exam(Model model) {
		return "examinationWeb/exam";
	}

	@Log("跳转考试结束页面")
	@GetMapping("/endExam")
	String endExam(Model model) {
		return "examinationWeb/endExam";
	}

	@Log("跳转考试恢复异常页面")
	@GetMapping("/abnormal")
	String abnormal(Model model) {
		return "examinationWeb/abnormal";
	}


}
